package main

import "fmt"

/*
   四种变量声明方式
*/

var gA int = 100
var gB = 200

// := 只能够用在 函数体内
// gC := 12312

func main() {
	//
	var a int
	fmt.Println("a = ", a)
	fmt.Printf("type of a = %T\n", a)

	// method 2
	var b int = 100
	fmt.Println("b = ", b)
	fmt.Printf("type of b = %T\n", b)

	var bb string = "abcd"
	fmt.Printf("bb = %s, type of bb = %T\n", bb, bb)

	// method 3
	var c = 100
	fmt.Println("c = ", c)
	fmt.Printf("type of c = %T\n", c)

	var cc = "abcd"
	fmt.Printf("cc = %s, type of cc = %T\n", cc, cc)

	//method 4
	e := 100
	fmt.Println("e = ", e)

	f := "qewr"
	fmt.Println("f = ", f)

	g := 3.14
	fmt.Println("g = ", g)
	fmt.Printf("type of g = %T\n", g)

	// ========
	fmt.Println("gA = ", gA, ", gB = ", gB)
	// fmt.Println("gC = ", gC )

	// 声明多个变量
	var xx, yy int = 1234, 4321
	fmt.Println("xx = ", xx, ", yy = ", yy)
	var kk, ll = 100, "abcdef"
	fmt.Println("kk = ", kk, ", ll = ", ll)

	// 多行的变量声明
	var (
		vv int  = 100
		jj bool = true
	)

	fmt.Println("vv = ", vv, ", jj = ", jj)

}
